#ifndef _WEB_INTERNAL
#define _WEB_INTERNAL

#include "fcgiapp.h"
#include "json_object.h"

#define WEB_STATUE_STR_400  "400 Bad Request"
#define WEB_STATUE_STR_404  "404 Not Found"
#define WEB_STATUE_STR_500  "500 Internal Server Error"
#define WEB_STATUE_STR_200_OK  "200 OK"

enum RT_VALUE
{
    RT_ERR = -1,
    RT_OK = 0
};

typedef struct _fcgxEnvParams
{
    FCGX_Request *req;
    char *server_name;
    char *query_string;
    char *request_uri;
    int content_Length;
    char *request_method;
}fcgxEnvParams;

#define QUERY_STRING_VALUE_MAX_LEN   50

typedef struct _queryStringInfo
{
    char version[QUERY_STRING_VALUE_MAX_LEN]; // 添加API版本字段
    char method[QUERY_STRING_VALUE_MAX_LEN];
    char func[QUERY_STRING_VALUE_MAX_LEN];
}queryStringInfo;


void extract_url_param(char *url,const char *pname,char* pvalue,int len);
void web_respone_err(FCGX_Request *req,const char *err_str) ;
void web_respone_json(FCGX_Request *req,struct json_object *obj);
int parse_query_string(char *query_string,queryStringInfo *queryInfos);
int parse_rest_api_path(char *uri, queryStringInfo *queryInfos);

#endif